// pages/home/tuangou/tgxq/tgxq.js
const http = require('../../js/ajax.js')
const api = require('../../js/api.js')
Page({

  /**
   * 页面的初始数据
   */
  data: {
    splb:[]
  },
  tg() {
    let date = {
      "status": "1",
      "shopId": 18,
      "storeId": 56200,
      "salesCategoryId": 830064,
      "sortType": 5,
      "isAsc": false,
      "teminal": 2,
      "customerId": 589,
      "currentPage": 0,
      "pageSize": 15
    }
    http(api.splb, "data", date, "POST").then(res => {
      // console.log(res)
      if (res.data.status.statusCode === 0) {
        this.setData({
          splb: res.data.result.items
        })
      }
      //console.log(this.data.splb)
    })
  },
  //加
  jia(e) {
    var that = this
    //console.log(e)
    this.setData({
      idaa: e.currentTarget.dataset.id
    })
    //console.log(this.data.idaa)
    let data = {
      customerId: 589,
      shopId: 18,
      goodsId: this.data.idaa,
      quantity: 598,
      teminal: 2,
      storeId: 56200
    }
    http(api.slja, "data", data, "POST").then(res => {
      console.log('2222222222222222222222', res)
      this.tg()
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    this.tg()
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})